import sys
from ApiTools import apiTools,apiBase

# 向量名称,如果类型的dir,那向量名称是文件夹
dir_path = apiBase.argv(1,'/home/softrobot/llm/qwne05/rag/')
# 验证api
verify_api = apiBase.argv(2,'http://8.130.66.117:8082/88api/langgraph/echoA.hpl')
code = apiBase.argv(3,'小红薯不好吃')
sys_prompt = None
usr_prompt = apiBase.argv(4,'小红薯好吃吗?')
fix_prompt = apiBase.argv(5,'修复code里面错误')


#修复成功,返回正确值
try:
    apiTools.load_vec()
    ret=apiTools.rag_fix("dir",verify_api,dir_path,code,sys_prompt,usr_prompt,fix_prompt)
    print(ret)
except Exception as e:
    print(f"Exception:{e}") 
finally:    
    apiBase.close()

# # 向量名称,如果类型的dir,那向量名称是文件夹
# dir_path = apiBase.argv(1,'/data/bzmwork/softrobot/llm/codeqwen-7b/txt/')
# # 验证api
# verify_api = apiBase.argv(2)
# code = apiBase.argv(3,'小红薯不好吃')
# sys_prompt = apiBase.argv(4)
# usr_prompt = apiBase.argv(5,'小红薯好吃吗?')
# fix_prompt = apiBase.argv(6,'修复code里面错误')


# #修复成功,返回正确值
# try:
#     ret=apiTools.rag_fix("dir",verify_api,dir_path,code,sys_prompt,usr_prompt,fix_prompt)
#     print(ret)
# except Exception as e:
#     print(f"Exception:{e}") 
# finally:    
#     apiBase.close()
    
# # 向量名称,如果类型的dir,那向量名称是文件夹
# vec_name = apiBase.argv(1,'doc-name')
# # 验证api
# verify_api = apiBase.argv(2)
# code = apiBase.argv(3,)
# sys_prompt = apiBase.argv(4,)
# usr_prompt = apiBase.argv(5,'小红薯好吃吗?')
# fix_prompt = apiBase.argv(6,'修复里面错误')

# #修复成功,返回正确值
# try:
#     ret=apiTools.rag_fix("txt",verify_api,vec_name,code,sys_prompt,usr_prompt,fix_prompt)
#     print(ret)
# except Exception as e:
#     print(f"Exception:{e}") 
# finally:    
#     apiBase.close()